home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 October
/
PCWorld_2004-10_cd.bin
/
software
/
temacd
/
sandra
/
san2004.SP2b-9133-Win32-SSO.exe
/
{app}
/
examples
/
Oracle Schema.sql
< prev
next >
Wrap
Text File
|
2004-03-25
|
4KB
|
162 lines
--
-- Oracle 7.3.3.x.x/8.0.4.x.x Schema for Sandra Report
--
-- Schema is assumed to have been created already.
-- No extents included, please add as required.
--
-- Copyright 1995-2004, C. A. Silasi, SiSoftware.
-- All Rights Reserved.
--
-- Kill all tables
--
DROP TABLE TItem;
DROP TABLE TItemGroup;
DROP TABLE TDevice;
DROP TABLE TClass;
DROP TABLE TModule;
DROP TABLE TReport;
DROP TABLE TIDCount;
--
-- Kill all sequences
--
DROP SEQUENCE seqItem;
DROP SEQUENCE seqItemGroup;
DROP SEQUENCE seqDevice;
DROP SEQUENCE seqClass;
DROP SEQUENCE seqModule;
DROP SEQUENCE seqReport;
--
-- Create new sequences
--
CREATE SEQUENCE seqItem MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqItemGroup MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqDevice MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqClass MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqModule MINVALUE 1 MAXVALUE 1000000000 CYCLE;
CREATE SEQUENCE seqReport MINVALUE 1 MAXVALUE 1000000000 CYCLE;
--
-- Create new tables
--
CREATE TABLE TReport (
ID INTEGER PRIMARY KEY,
ProgramName VARCHAR2(255),
ProgramVersion VARCHAR2(255),
RegisteredUser VARCHAR2(255),
RegisteredCompany VARCHAR2(255),
LicenceStatus VARCHAR2(255),
LicenceExtra VARCHAR2(255),
UserID VARCHAR2(255),
HostName VARCHAR2(255),
SystemID VARCHAR2(255),
WebUserID VARCHAR2(255),
RunID VARCHAR2(255),
RunDate DATE DEFAULT SYSDATE,
Completed NUMBER(1) NOT NULL
);
CREATE TABLE TModule (
ID INTEGER PRIMARY KEY,
ReportID INTEGER REFERENCES TReport(ID),
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HasClass NUMBER(1) NOT NULL,
HasDevice NUMBER(1) NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE TClass (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES TModule(ID),
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE TDevice (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES TModule(ID),
ClassID INTEGER,
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE TItemGroup (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES TModule(ID),
ClassID INTEGER,
DeviceID INTEGER,
Name VARCHAR2(255) NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE TItem (
ID INTEGER PRIMARY KEY,
ModuleID INTEGER REFERENCES TModule(ID),
GroupID INTEGER,
Name VARCHAR2(255) NOT NULL,
DataValue VARCHAR2(255),
IconID INTEGER NOT NULL,
TypeID INTEGER NOT NULL,
HelpID INTEGER NOT NULL
);
CREATE TABLE TIDCount (
TableName VARCHAR2(10) PRIMARY KEY,
CurrentID INTEGER NOT NULL
);
--
-- Set-up keys/indexes
--
CREATE INDEX ndxUserID ON TReport(UserID);
CREATE INDEX ndxSystemID ON TReport(SystemID);
CREATE INDEX ndxWebUserID ON TReport(WebUserID);
CREATE INDEX ndxModuleName ON TModule(Name);
CREATE INDEX ndxItemName ON TItem(Name);
--
-- Inserts
--
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TItem', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TItemGroup', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TDevice', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TClass', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TModule', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TReport', 1);